const totalPages = 5;
                    let currentPage = 1;
            
                    function generatePagination() {
                        const pagination = document.getElementById('pagination');
                        const con = document.getElementById('con');
                        pagination.innerHTML = '';
            
                        for (let i = 1; i <= totalPages; i++) {
                            const pageItem = document.createElement('a');
                            pageItem.href = '#';
                            pageItem.innerText = i;
                            pageItem.classList.add('page-item');
            
                            if (i === currentPage) {
                                pageItem.classList.add('active');
                            }
            
                            pageItem.addEventListener('click', (e) => {
                                e.preventDefault();
                                currentPage = parseInt(e.target.innerText);
                                generateContent();
                                generatePagination();
                            });
            
                            pagination.appendChild(pageItem);
            
            
                        }
                    }
            
                    function generateContent() {
                        const con = document.getElementById('content');
                        const WenBenList=["材料科学与工程学院教工党支部赴湖口开展主题党日活动",
                                          "从党史中汲取力量，厚植爱党爱国情怀",
                                          "材料科学与工程学院开展《机械制图》公开示范课活动",
                                          "校党委书记李明斌深入材料学院调研",
                                          "规划启航，职引未来"                     
                    ]
            
                        const imgSrc=["../Web大作业/imag/swiper1.jpg",
                        "../Web大作业/imag/swiper2.jpg",
                        "../Web大作业/imag/swiper3.jpg",
                        "../Web大作业/imag/swiper4.jpg",
                        "../Web大作业/imag/swiper5.jpg"
                    ]
                        
                        // 获取图片元素
                        var img = document.getElementById("img_list");
                        var wenben=document.getElementById("wenben")
                        wenben.textContent=WenBenList[currentPage-1]
                        img.src=imgSrc[currentPage-1]
            
                        }
                    
            
                    generateContent();
                    generatePagination();